﻿@using KRM.Core
@model KRM.Core.tblKRMTradeCustomer
@{
    IEnumerable<v_Invoicing> allInvoice = ViewBag.AllInvoice;
}
<script>
    $(document).ready(function () {
        $(".btn-createnewinvoice").click(function () {
            PopupCenter('/trade/createnewinvoice?accnumber=@Model.TradeAccNumber&typeinvoice=' + $("#cb-typeinvoice").val(), 900, 600);
        });
    })
</script>
<div class="row-fluid">
    <div class="span3">
        <input type="button" class="btn btn-primary btn-createnewinvoice" value="Create New Invoice" />
    </div>
    <div class="span3"></div>
    <div class="span3">
        <select class="input-block-level" id="cb-typeinvoice">
            <option value="InvoiceStandard">InvoiceStandard</option>
            <option value="InvoiceHomebase">InvoiceHomebase</option>
        </select>
    </div>
    <div class="span3">
        <input type="button" class="btn btn-primary" value="Set Default Template" onclick="javascript: alert('Set Template complete');" />
    </div>
</div>

<div class="fieldset">
    <div class="legend">
        <span>Previous Invoices</span>
    </div>
    <div class="previous-invoices">
        <table class="table tbl-selected table-bordered table-fix">
            <thead>
                <tr>
                    <th>InvoiceNumber</th>
                    <th>InvoiceDate</th>
                    <th>OrderQty</th>
                    <th>Status</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in allInvoice)
                {
                    <tr onclick="previousinvoicesselected(@item.Id)">
                        <td>@item.InvoiceNumber</td>
                        <td>@item.InvoiceDate</td>
                        <td>@item.OrderQty</td>
                        <td>@item.Status</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
<div class="fieldset">
    <div class="legend">
        <span>Selected Invoice Orders Detail</span>
    </div>
    <div class="selected-invoices-order">
        <table class="table tbl-selected table-bordered table-fix">
            <thead>
                <tr>
                    <th>OrderDate</th>
                    <th>OrderRef</th>
                    <th>TradeOrderRef</th>
                    <th>Status</th>
                    <th>DeliveryDate</th>
                    <th>PONumber</th>
                    <th>ProductName</th>
                    <th>ProductCode</th>
                    <th>OrderItemValue(ExVat)</th>
                    <th>PriceListProductValue</th>
                    <th>InvoiceNumber</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
</div>
<div class="text-right">
    <a href="#" class="btn btn-primary btn-generateinvoice">Generate Invoice</a>
</div>
